import Vue from 'vue'
import VueRouter from 'vue-router'

import Login from '../views/login.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: Login
  },
  {
    path: '/index',
    name: 'index',
    redirect: '/checkitem',
    component: () => import('../views/index.vue'),
    children: [
      {
        path: '/checkitem',
        name: 'checkitem',
        component: () => import('../views/appoment/checkitem.vue')
      },
      {
        path: '/checkgroup',
        name: 'checkgroup',
        component: () => import('../views/appoment/checkgroup.vue')
      },
      {
        path: '/ordersetting',
        name: 'ordersetting',
        component: () => import('../views/appoment/ordersetting.vue')
      },
      {
        path: '/setmeal',
        name: 'setmeal',
        component: () => import('../views/appoment/setmeal.vue')
      },
      {
        path: '/report_setmeal',
        name: 'report_setmeal',
        component: () => import('../views/report/report_setmeal.vue')
      },
      {
        path: '/report_excel',
        name: 'report_excel',
        component: () => import('../views/report/report_excel.vue')
      },
      {
        path: '/report_member_sex',
        name: 'report_member_sex',
        component: () => import('../views/report/report_member_sex.vue')
      },
      {
        path: '/report_member_increase',
        name: 'report_member_increase',
        component: () => import('../views/report/report_member_increase.vue')
      },
      {
        path: '/menu',
        name: 'menu',
        component: () => import('../views/user/menu.vue')
      },
      {
        path: '/role',
        name: 'role',
        component: () => import('../views/user/role.vue')
      },
      {
        path: '/user',
        name: 'user',
        component: () => import('../views/user/user.vue')
      }
    ]
  }
]

/*const routes = function getMenus() {
  this.$http.get('api/menu/getMenus').then(res => {
    if(res.data.flag){
      return res.data.data
    }
  })
}*/

const router = new VueRouter({
  routes
})

export default router
